//
//  MovieDetailView.m
//  UI_豆瓣2.0
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieDetailView.h"

@interface MovieDetailView ()

@property (nonatomic, retain)UIImageView *photoImageView; // 照片
@property (nonatomic, retain)UILabel *ratingLabel;        // 评分
@property (nonatomic, retain)UILabel *ratingScoreLabel;   // 评分分数
@property (nonatomic, retain)UILabel *ratingCountLabel;   // 评论数
@property (nonatomic, retain)UILabel *dataLabel;          // 日期
@property (nonatomic, retain)UILabel *genresLabel;        // 类型
@property (nonatomic, retain)UILabel *countryLabel;       // 国家
@property (nonatomic, retain)UILabel *actorLabel;         // 制作人
@property (nonatomic, retain)UILabel *actorDetailLabel;   // 制作人详情
@property (nonatomic, retain)UILabel *plotLabel;          // 电影情节
@property (nonatomic, retain)UILabel *timeLabel;          // 时长

@end

@implementation MovieDetailView


- (void)dealloc
{
    [_ratingScoreLabel release];
    [_timeLabel release];
    [_photoImageView release];
    [_ratingLabel release];
    [_ratingCountLabel release];
    [_dataLabel release];
    [_genresLabel release];
    [_countryLabel release];
    [_actorLabel release];
    [_actorDetailLabel release];
    [_plotDetailLabel release];
    [_plotLabel release];
    //    [_aMobieDetail release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}


- (void)createSubViews{
    
    self.photoImageView = [[UIImageView alloc] initWithFrame:CGRectMake(20, 25, 100, 150)];
    self.photoImageView.image = [UIImage imageNamed:@"picholder.png"];
    [self addSubview:self.photoImageView];
    [_photoImageView release];
    
    self.ratingLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 30, 50, 20)];
    self.ratingLabel.text = @"评分:";
    self.ratingLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.ratingLabel];
    [_ratingLabel release];
    
    self.ratingScoreLabel = [[UILabel alloc] initWithFrame:CGRectMake(195, 30, 50, 20)];
    //    self.ratingScoreLabel.text = @"7.1";
    self.ratingScoreLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.ratingScoreLabel];
    [_ratingScoreLabel release];
    
    self.ratingCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(235, 30, 100, 20)];
    //    self.ratingCountLabel.text = @"(4925评论)";
    self.ratingCountLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.ratingCountLabel];
    [_ratingCountLabel release];
    
    self.dataLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 60, 100, 20)];
    //    self.dataLabel.text = @"20140901";
    self.dataLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.dataLabel];
    [_dataLabel release];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 90, 100, 20)];
    //    self.timeLabel.text = @"126 min";
    self.timeLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.timeLabel];
    [_timeLabel release];
    
    self.genresLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 120, 100, 20)];
    //    self.genresLabel.text = @"动作/冒险/惊悚";
    self.genresLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.genresLabel];
    [_genresLabel release];
    
    self.countryLabel = [[UILabel alloc] initWithFrame:CGRectMake(150, 150, 100, 20)];
    //    self.countryLabel.text = @"美国|法国";
    self.countryLabel.font = [UIFont systemFontOfSize:15];
    [self addSubview:self.countryLabel];
    [_countryLabel release];
    
    self.actorDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 248, 340, 50)];
    //    self.actorDetailLabel.text = @"⻄西尔维斯特·史泰⻰龙 Sylvester Stallone,杰森·斯坦森 Jason Statham,梅尔·吉布森 MelGibson,李连杰 Jet Li";
    self.actorDetailLabel.font = [UIFont systemFontOfSize:15];
    self.actorDetailLabel.numberOfLines = 0;
    [self addSubview:self.actorDetailLabel];
    [_actorDetailLabel release];
    
    self.actorLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 200, 200, 40)];
    self.actorLabel.text = @"制作人";
    self.actorLabel.font = [UIFont systemFontOfSize:22];
    [self addSubview:self.actorLabel];
    [_actorLabel release];
    
    self.plotLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 330, 200, 40)];
    self.plotLabel.text = @"电影情节";
    self.plotLabel.font = [UIFont systemFontOfSize:22];
    [self addSubview:self.plotLabel];
    [_plotLabel release];
    
    self.plotDetailLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 378, 340, 50)];
    //    self.plotDetailLabel.text = @"在此次第三部的故事中,巴尼(史泰⻰龙饰)与克⾥里斯⻢马斯(杰森·斯坦森饰)领衔的敢死队将正⾯面迎战昔⽇日战友、如今的军⽕火枭雄康拉德·斯通班克斯(梅尔·吉布森 饰)。";
    self.plotDetailLabel.font = [UIFont systemFontOfSize:15];
    self.plotDetailLabel.numberOfLines = 0;
    [self addSubview:self.plotDetailLabel];
    [_plotDetailLabel release];
    
}

- (void)sendInfo{
    self.ratingScoreLabel.text = self.movieDDV.rating;
    NSString *str = self.movieDDV.rating_count;
    NSString *str1 = [NSString stringWithFormat:@"(%@评论)", str];
    self.ratingCountLabel.text = str1;
    self.dataLabel.text = self.movieDDV.release_date;
    self.genresLabel.text = self.movieDDV.genres;
    self.countryLabel.text = self.movieDDV.country;
    self.actorDetailLabel.text = self.movieDDV.actors;
    [self.actorDetailLabel sizeToFit];
    self.plotDetailLabel.text = self.movieDDV.plot_simple;
    [self.plotDetailLabel sizeToFit];
    [self.photoImageView sd_setImageWithURL:[NSURL URLWithString:self.movieDDV.picture] placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    self.timeLabel.text = self.movieDDV.runtime;
}




/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
